<template>
  <j-modal title="查看处置结果" :width="600" :visible="visible" :confirmLoading="loading" switchFullscreen
    @cancel="handleCancel" @ok="handleOk">
    <p class="pt">未报到信息</p>
    <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">

      <a-form-model-item label="姓名：">
        <div>{{ recorddata.name }}</div>
      </a-form-model-item>
      <a-form-model-item label="户籍地详址：">
        <div>{{ recorddata.address }}</div>
      </a-form-model-item>
      <a-form-model-item label="应报到截止时间：">
        <div>{{ recorddata.reportToTime }}</div>
      </a-form-model-item>
      <a-form-model-item label="当前时间">
        <div>{{ timestampToTime2() }}</div>
      </a-form-model-item>
      <a-form-model-item label="未报到理由">
        <div>{{ Viewdata.reasonNotReport }}</div>
      </a-form-model-item>
      <a-form-model-item label="通知派出所单位">
        <div>{{ Viewdata.notifyPoliceUnit }}</div>
      </a-form-model-item>
      <a-form-model-item label="接受民警">
        <div>{{ Viewdata.receivePolice }}</div>
      </a-form-model-item>
      <a-form-model-item label="情况说明文档">
        <div style="color:#1890FF" v-if="Viewdata.informationDoc">{{ Viewdata.informationDoc }}</div>
        <div style="color:#1890FF" v-else>社区戒毒社区康复人员违法/违规行为报告.pdf</div>
      </a-form-model-item>
    <br>
    <p class="pt">处置结果</p>  
    <br>
    <a-form-model-item label="处置结果">
        <div>{{ Viewdata.disposalResult }}</div>
      </a-form-model-item>
      <a-form-model-item label="附件">
        <div v-if="Viewdata.disposalFile">{{ Viewdata.disposalFile }}</div>
        <div v-else>/</div>
      </a-form-model-item>
      <a-form-model-item label="其他说明">
        <div v-if="Viewdata.otherDisInstructions">{{ Viewdata.otherDisInstructions }}</div>
        <div v-else>/</div>
      </a-form-model-item>

  </a-form-model>

  </j-modal>
</template>

<script>
  
  import {viewManagement} from '@/api/sjsk/reportList.js'
  export default {
    // name: 'AddModal',
    data() {
      return {
        visible: false,
        // managementdata: {},
        loading: false, 
        recorddata:{},
        Viewdata:{},
        labelCol: { span: 5 },
        wrapperCol: { span: 14 },
        form: {},
      }
    },
    async created() {
    },
    methods: {
      show(record) {
        this.visible = true
        this.recorddata = record
        this.Viewreport()
      },
      Viewreport() {
        let {id} = this.recorddata
        let quary = {
          id:id,
        }
        // console.log(this.timestampToTime2());
        viewManagement(quary).then(res => {
          console.log(res);
          if (res.success) {
            this.Viewdata = res.result
            // this.$message.success('未报到处置申请'+res.message)
          }
          else {
              this.loading = false
              this.$message.warn(res.message)
            }
        }).catch(e => {
              this.loading = false
              this.$message.warn('请求失败！')
            })
      },
      handleCancel() {
        this.visible = false
        this.form = {}
        this.Viewdata = {}
      },
      handleOk() {
        this.visible = false
        this.Viewdata = {}
        // console.log(new Date(this.form.newreportToTime));
        // console.log(this.form);
      },
      // 将新报到截止时间转化为正确的格式
      timestampToTime2() {
          var date = new Date(Date.parse(new Date()))
          var Y = date.getFullYear() + '-'
          var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
          var D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' '
          var H = date.getHours() + ':'
          var M2 = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
          var S = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
          return Y + M + D + H + M2 + S
      }
    },
  }
  </script>
  <style lang="less" scoped>
  .pt {
    font-weight: bold;
  }
  
  .pl {
    padding-top: 20px;
    border-top: 1px dotted #ccc;
  }
  
  .ant-row {
    margin-left: 10px;
  }
  
  .item1 {
    width: 100%;
    position: relative;
    left: -2%;
  
    /deep/.ant-col-6 {
      width: 10.5%;
      // text-align: left;
    }
  
    /deep/.ant-col-16 {
      width: 70%;
      text-align: left;
    }
  }
  
  .item2 {
    margin-left: 115px;
    margin-bottom: 20px;
  
    p {
      display: inline-block;
    }
  
    .box {
      display: inline-block;
      margin-left: 90px;
      margin-right: 20px;
    }
  }
  </style>